﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using Model;
namespace DAL
{
    /// <summary>
    /// 成绩表数据访问类
    /// </summary>
    public class ScoreService
    {
        /// <summary>
        /// 根据把你名称查询成绩信息
        /// </summary>
        /// <param name="className"></param>
        /// <returns></returns>
        public List<StudentExt> GetScoreList(string className)
        {
            SqlParameter[] sqlParameters = new SqlParameter[]
            {
                new SqlParameter("@ClassName",className)
            };

            SqlDataReader reader = SqlHelper.ExecuteReader("usp_QueryScore",sqlParameters,true);
            List<StudentExt> scoreLists = new List<StudentExt>();
            while (reader.Read())
            {
                scoreLists.Add(new StudentExt
                {
                    StudentId = Convert.ToInt32(reader["StudentId"]),
                    StudentName = reader["StudentName"].ToString(),
                    ClassName = reader["ClassName"].ToString(),
                    Gender = reader["Gender"].ToString(),
                    //ClassId = Convert.ToInt32(reader["ClassId"]),
                    CSharp = Convert.ToInt32(reader["CSharp"]),
                    SQLServerDB = Convert.ToInt32(reader["SQLServerDB"])
                });
            }
            reader.Close();
            return scoreLists;

        }


    }
}
